LocalStorage

abstract class LocalStorage(var book: AccountBook, val folderStorage: SyncStorage) : SyncRecord, SyncStorage

Created by sreilly - 01/08/2014 09:27

Constructors

Link copied to clipboard
constructor(book: AccountBook, folderStorage: SyncStorage)

Properties

Link copied to clipboard
protected var authenticationCache: SyncRecord?
Link copied to clipboard
Link copied to clipboard
val buffer: Buffer
Link copied to clipboard
Link copied to clipboard
val folderStorage: SyncStorage
Link copied to clipboard
open override val isEmpty: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val size: Int
Link copied to clipboard
open override var subpath: String?
Link copied to clipboard
open override val syncTypeID: String?
Link copied to clipboard
open override val underlyingPathOrURL: String?
Link copied to clipboard

Functions

Link copied to clipboard

Used by OnlineService to cache authentication

Link copied to clipboard
open fun clear()
Link copied to clipboard

Remove any stored passwords for the given service whose key begins with the given prefix

Link copied to clipboard
open override fun clone(): SyncRecord
Link copied to clipboard
open fun containsKey(key: String): Boolean
Link copied to clipboard
open fun containsValue(value: String?): Boolean
Link copied to clipboard
open override fun createParents()
Link copied to clipboard
abstract override fun delete(filename: String)

Deletes a local data file or folder. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
open override fun encryptBytes(bytesToEncrypt: ByteArray): ByteArray
Link copied to clipboard
abstract override fun exists(filename: String?): Boolean

Returns true iff a file exists at the given path in the safe storage. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
open override fun folderForPath(subfolderPath: String): SyncFolder
Link copied to clipboard
open operator fun get(key: String): String?
Link copied to clipboard
fun getBoolean(key: String, defaultValue: Boolean): Boolean
Link copied to clipboard
Link copied to clipboard

Used by local modules to retrieve cached authentication and other secure information

Link copied to clipboard
fun getDouble(key: String): Double?
fun getDouble(key: String, defaultValue: Double): Double
Link copied to clipboard
Link copied to clipboard
fun getInt(key: String): Int?
fun getInt(key: String, defaultValue: Int): Int
Link copied to clipboard
Link copied to clipboard
fun getLong(key: String): Long?
fun getLong(key: String, defaultValue: Long): Long
Link copied to clipboard
open override fun getModified(path: String?): Date?
Link copied to clipboard
open override fun getPathInfo(relativePathFromBase: String?, isDirectory: Boolean, includeTimestamps: Boolean, recursive: Boolean, isCanceled: () -> Boolean): SyncFileInfo
Link copied to clipboard
open override fun getSize(ofFile: String?): Long?
Link copied to clipboard
fun getStr(key: String, defaultValue: String?): String?
Link copied to clipboard
fun getString(key: String): String?
fun getString(key: String, defaultValue: String?): String?
Link copied to clipboard
fun getStringList(keyString: String): List<String>
Link copied to clipboard
fun getStringWithDefault(key: String, defaultValue: String): String
Link copied to clipboard
fun getSublist(prefix: String): List<SyncRecord>
Link copied to clipboard
fun getSubset(prefix: String): SyncRecord
Link copied to clipboard
abstract override fun isFolder(filename: String): Boolean

Returns true iff a file at the given path exists and is a folder. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
abstract override fun listFiles(dirPath: String?): List<String>

Returns a list of files under the given folder path. If folderPath is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
abstract override fun listSubfolders(dirPath: String?): List<String>

Returns a list of folders under the given folder path. If folderPath is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
abstract override fun moveFile(fromFile: String, toFileOrFolder: String)

Move or rename the given fromFile to the given file or folder.

Link copied to clipboard
abstract override fun openFileForReading(filename: String): BufferedSource

Reads from a local data file, decrypting as it goes. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
abstract override fun openFileForWriting(filename: String): BufferedSink

Returns a stream for writing to a local data file, encrypting as it goes. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
fun printHumanReadableContents(out: BufferedSink)
Link copied to clipboard
fun put(name: String, value: SyncRecord)
fun put(key: String, vectorValue: StreamVector?)
open fun put(key: String, value: Any?)
fun put(key: String, value: Boolean)
fun put(key: String, value: Double)
fun put(key: String, value: Int)
fun put(key: String, value: IntArray?)
fun put(key: String, value: Long)
open override fun put(key: String, value: String?): String?
fun put(name: String, sublist: List<*>?)
fun put(name: String, value: Map<*, *>?)
open fun put(key: String?, value: ByteArray?)
Link copied to clipboard
open fun putAll(m: Map<out String, out String?>)
Link copied to clipboard
open fun putAllFromMap(map: Map<*, *>, excludingKeys: List<Any>?)
Link copied to clipboard
fun putInline(name: String, value: List<String>?)
open fun putInline(name: String?, value: SyncRecord)
Link copied to clipboard
abstract fun readFile(filename: String?, sinkStream: OutputStream?): Long

Reads from a local data file, decrypting as it goes. The data is read from the given local file, decrypted, and then written to the given output stream. If filename is a relative path (which it should be) it will be based on the safe root of the data folder. Returns the number of (decrypted) bytes read and copied.

open override fun readFile(fileToRead: String): BufferedSource
open override fun readFile(filename: String, sinkStream: BufferedSink): Long
Link copied to clipboard
fun readSet(source: Reader): Boolean
fun readSet(source: String): Boolean
fun readSet(source: BufferedSource): Boolean
Link copied to clipboard
fun readSetByByte(source: BufferedSource): Boolean
Link copied to clipboard
fun readSetByLine(source: BufferedSource): Boolean
Link copied to clipboard
open override fun readUnencrypted(fileToRead: String): BufferedSource
Link copied to clipboard
fun removeSubset(prefix: String?)
Link copied to clipboard
abstract fun save(): Boolean

Saves the key-value data to local storage

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
abstract fun writeFile(filename: String, dataToWrite: InputStream?)

Writes to a local data file, encrypting as it goes. The data to write is read from the given input stream. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

abstract override fun writeFile(path: String, streamToWrite: BufferedSource)

Writes to a local data file, encrypting as it goes. The data to write is read from the given buffered source. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
fun writeSet(out: BufferedSink)
Link copied to clipboard
Link copied to clipboard
abstract override fun writeToFileAtomically(bytesToWrite: ByteArray, destinationFilename: String)

Encrypts and writes to a local data file atomically. The given data is saved to the file atomically. That is, it does everything possible to ensure the write will succeed before actually changing the target file. Any IO exceptions should be thrown before the target file is touched. If filename is a relative path (which it should be) it will be based on the safe root of the data folder.

Link copied to clipboard
Link copied to clipboard
open override fun writeUnencryptedFile(fileToWrite: String, streamToWrite: BufferedSource)